package io.sdph.statistics;

import io.sdph.statistics.model.OrdersStatistic;
import io.sdph.statistics.model.ProductsStatistic;
import io.sdph.statistics.model.UsersStatistic;
import io.sdph.statistics.dao.StatisticsManagerDAO;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Manager zarządzający statystykami.
 * 
 * @author 
 * @since 0.0.1
 */
@Service
public class StatisticsManager implements IStatisticsManager {
	static final Logger log = Logger.getLogger(StatisticsManager.class);
	
	@Autowired
	StatisticsManagerDAO dao;
	

	@Override
	public void doStatistics() {
		log.info("doStatistics() method");
		DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
		Date currentDate = new Date();
		ProductsStatistic productsStatistic = new ProductsStatistic(currentDate);
		OrdersStatistic ordersStatistic = new OrdersStatistic(currentDate);
		UsersStatistic usersStatistic = new UsersStatistic(currentDate);
		
		dao.saveProductsStatistic(productsStatistic);
		dao.saveOrdersStatistic(ordersStatistic);
		dao.saveUsersStatistic(usersStatistic);
	}

}